package com.sdry.web.controller.lz;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.sdry.model.lz.Customer;
import com.sdry.model.lz.InventoryOrder;
import com.sdry.model.lz.OutStockOrder;
import com.sdry.model.lz.Warehouse;
import com.sdry.model.zc.ZcGeneralQueryEntity;
import com.sdry.model.zc.ZcSysUserEntity;
import com.sdry.service.lz.CustomerService;
import com.sdry.service.lz.InventoryService;
import com.sdry.service.lz.StockOutOrderService;
import com.sdry.service.zc.ZcSystemService;

/**
 * 
 * @ClassName StockOutController
 * @Description 入库单跳转菜单
 * @Author lz
 * @Date 2019年3月5日 10:39:13
 * @Version 1.0
 */
@Controller
@RequestMapping("/stockOutMenu")
public class StockOutMenu {
	@Resource
	InventoryService inventoryService;
	@Resource
	ZcSystemService zcSystemService;
	@Resource
	StockOutOrderService stockOutService;
	@Resource
	CustomerService customerService;
	
	//入库单导入
	@RequestMapping("/stockOutExport")
	public String stockOutExport(){
		return "/lz/stock_out_export";
	}

	//出库
	@RequestMapping("/stockOut")
	public String stockOut(){
		return "/lz/stock_out";
	}

	//异常调整
	@RequestMapping("/abnormalAdjustment")
	public String abnormalAdjustment(Model model){
		List<OutStockOrder> allOutStockOrder = stockOutService.queryAllOutStockOrder();
		model.addAttribute("allOutStockOrder", allOutStockOrder);
		List<Customer> allcustomer = stockOutService.queryAllCustomerByType();
		model.addAttribute("allcustomers", allcustomer);
		return "/lz/abnormal_adjustment";
	}
	
	//装车处理
	@RequestMapping("/loadingProcess")
	public String loadingProcess(){
		return "/lz/loading_process";
	}
	
	//盘点管理
	@RequestMapping("/inventoryManagement")
	public String inventoryManagement(Model model){
		List<ZcSysUserEntity> userList = inventoryService.queryAllUser();
		model.addAttribute("userList", userList);
		List<Warehouse> warehouseList = inventoryService.queryAllWarehouseAndroid();
		model.addAttribute("warehouseList", warehouseList);
		List<Customer> allcustomer = stockOutService.queryAllCustomerByType();
		model.addAttribute("allcustomer", allcustomer);
		return "/lz/inventory_management";
	}
	
	//损溢管理
	@RequestMapping("/lossSpilloverManagement")
	public String lossSpilloverManagement(Model model){
		List<InventoryOrder> list = inventoryService.queryAllInventoryOrder();
		model.addAttribute("allInventory", list);
		return "/lz/loss_spillover_management";
	}

	//地区信息
	@RequestMapping("/region")
	public String region(){
		return "/lz/region";
	}

	//仓库信息
	@RequestMapping("/warehouse")
	public ModelAndView warehouse(){
		ModelAndView mav = new ModelAndView();
		ZcGeneralQueryEntity zcGeneralQueryEntity = new ZcGeneralQueryEntity();
		List<ZcSysUserEntity> allUser = zcSystemService.selectAllSysUserList(zcGeneralQueryEntity);
		mav.addObject("allUser",allUser);
		mav.setViewName("/lz/warehouse");
		return mav;
	}

	//库区信息
	@RequestMapping("/warehouseRegion")
	public String warehouseRegion(){
		return "/lz/warehouse_region";
	}

	//库位信息
	@RequestMapping("/warehouseRegionLocation")
	public String warehouseRegionLocation(){
		return "/lz/warehouse_region_location";
	}

	//部门信息
	@RequestMapping("/dept")
	public ModelAndView dept(){
		ModelAndView mav = new ModelAndView();
		ZcGeneralQueryEntity zcGeneralQueryEntity = new ZcGeneralQueryEntity();
		List<ZcSysUserEntity> allUser = zcSystemService.selectAllSysUserList(zcGeneralQueryEntity);
		mav.addObject("allUser",allUser);
		mav.setViewName("/lz/dept");
		return mav;
	}

	//员工信息
	@RequestMapping("/staff")
	public String staff(){
		return "/lz/staff";
	}
	
	//车辆信息
	@RequestMapping("/car")
	public String car(){
		return "/lz/car";
	}

	//岗位信息
	@RequestMapping("/post")
	public String post(){
		return "/lz/post";
	}

	//客户信息
	@RequestMapping("/customer")
	public String customer(){
		return "/lz/customer";
	}

	//客户信息
	@RequestMapping("/contacts")
	public String contacts(){
		return "/lz/contacts";
	}
	
	//物料信息
	@RequestMapping("/materiel")
	public ModelAndView materiel(){
		ModelAndView mav = new ModelAndView();
		List<Customer> customerList = stockOutService.queryAllCustomer();
		mav.setViewName("/lz/materiel");
		mav.addObject("customerList",customerList);
		return mav;
	}

	//物料明细
	@RequestMapping("/materiel_detail")
	public String materiel_detail(){
		return "/lz/materiel_detail";
	}

	//容器信息
	@RequestMapping("/container")
	public String container(){
		return "/lz/container";
	}

}
